<?php


namespace App\Http\Controllers\Api\Repositories;
use App\Models\WxNotice as Model;

class WxNoticeRepositories
{
    protected $eloquentClass = Model::class;
    public static function addNotice($notice_code, $uid,$title,$content,$noticeType,$posts_id = '',$order_id = '', $url= '')
    {
        $noticeModel = new Model();
        $noticeModel->user_id = $uid;
        $noticeModel->posts_id = $posts_id;
        $noticeModel->order_id = $order_id;
        $noticeModel->title = $title;
        $noticeModel->content = $content;
        $noticeModel->is_read = 0;
        $noticeModel->notice_type = $noticeType;// 类型(0系统通知，1活动通知，2笔记点赞通知，3笔记收藏通知，4笔记评论通知，5评论点赞通知)
        $noticeModel->icon_type = $notice_code;
        if(!_empty_($url)){
            $noticeModel->url = $url;
        }
        $r = $noticeModel->save();
        return $r;
    }
}
